<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../tpl/head.jsp"%>
<link rel="stylesheet" href="statics/css/BasicData/tpl/setting.css" />
<script src="statics/lib/extend/tipso.min.js"></script>
<link rel="stylesheet" href="statics/lib/extend/tipso.min.css">
<div class="page">
	<div class="layui-card-header layui-bg-cyan">
		<span id="cinfo">邮件设置</span>
	</div>
	<div class="mc">
		<div class="mulu">
		 	<br><br>
			<input type="text" hidden id="nowAccId">
			<br><br>
			<ul class="layui-nav layui-nav-tree layui-fluid" lay-filter="demo" style="width: 100%;">
				<li class="layui-nav-item  layui-this"><a href="javascript:void(0)" data-nav="zhanghao">账号设置</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="infrastructure">基础设置</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="display">显示设置</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="closesend">抄送密送</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="blacklist">黑名单</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="signatureset">签名设置</a></li>
				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="receivingrules">收信规则</a></li>
<%--				<li class="layui-nav-item"><a href="javascript:void(0)" data-nav="auditrules">审批规则</a></li>--%>
			</ul>
		</div>
		<div style="flex:1">
			<div class="setting" id="zhanghao">
				<div class="zhanghaodiv">
					<div class="layui-form layui-form-tjzh">
						<button type="button" class="layui-btn layui-btn-normal shijian" data-type="tjzh" ><i class="layui-icon">&#xe624;</i>添加账号</button>
					</div>
					<hr>
					<ul class="yonghz" id="accounts">

					</ul>
				</div>
				<div class="zhanghaodivr">
					<div class="layui-tab layui-tab-brief">
						<ul class="layui-tab-title">
							<li class="layui-this">发送设置</li>
							<li class="">接收设置</li>
						</ul>
						<input type="text" hidden id="pop3_id">
						<input type="text" hidden id="smtp_id">
						<div class="layui-tab-content">
							<div  class="layui-tab-item  layui-show">
								<form class="layui-form" action="" lay-filter="editor-form-zhanghao">
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">显示名称</label>
											<div class="layui-input-inline">
												<input type="text" id="smtpName" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">发件人姓名</label>
											<div class="layui-input-inline">
												<input type="text" id="smtpsend_name" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">邮箱地址</label>
											<div class="layui-input-inline">
												<input type="text" id="smtpemail_adress" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">回复地址</label>
											<div class="layui-input-inline">
												<input type="text" id="smtpbank_adress" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">smtp服务器地址</label>
											<div class="layui-input-inline">
												<input type="text" id="smtp_server" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">邮箱账号</label>
											<div class="layui-input-inline">
												<input type="text" id="smtpemail_name" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">邮箱密码</label>
											<div class="layui-input-inline">
												<input type="password" id="smtpemail_password" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">邮箱授权码</label>
											<div class="layui-input-inline">
												<input type="password" id="smtpemail_code"  autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">端口号</label>
											<div class="layui-input-inline">
												<input type="text" id="smtp_port" autocomplete="off" class="layui-input">
											</div>
										</div>

										<div class="layui-inline">
											<label class="layui-form-label">SSL加密</label>
											<div class="layui-input-inline">
												<input type="checkbox" checked="checked" lay-skin="primary" name="like1" value="1">
											</div>
										</div>
									</div>
									<div class="padding text-right">
										<button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="form-element-zhanghao1" onclick="smtpLinkTest()">连接验证(成功保存)</button>
									</div>
								</form>
							</div>
							<div class="layui-tab-item">
								<form class="layui-form" action="" lay-filter="editor-form-zhanghao2">
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">显示名称</label>
											<div class="layui-input-inline">
												<input type="text" id="pop3_name" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">邮箱地址</label>
											<div class="layui-input-inline">
												<input type="text" id="popemail_adress" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">接收类型</label>
											<div class="layui-input-inline">
												<select lay-search name="receivetype" id="receivetype" lay-filter="receivetype">
													<option value="4" selected = "selected">Imap</option>
												</select>
											</div>
										</div>
										<div class="layui-inline" id="imapxs" style="display: none">
											<div class="layui-input-inline">
												<input type="checkbox" lay-skin="primary" name="yx" value="1" title="发件箱">
												<input type="checkbox" lay-skin="primary" name="yx" value="2" title="垃圾箱">
												<input type="checkbox" lay-skin="primary" name="yx" value="3" title="其他邮件箱">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">服务器地址</label>
											<div class="layui-input-inline">
												<input type="text" id="pop3_server" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">邮箱账号</label>
											<div class="layui-input-inline">
												<input type="text" id="popemail_name" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">邮箱密码</label>
											<div class="layui-input-inline">
												<input type="password" id="popemail_password" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">邮箱授权码</label>
											<div class="layui-input-inline">
												<input type="password" id="popemail_code" autocomplete="off" class="layui-input">
											</div>
										</div>
									</div>
									<div class="layui-form-item zdy-item-css">
										<div class="layui-inline">
											<label class="layui-form-label">SSL加密</label>
											<div class="layui-input-inline">
												<input type="checkbox" checked="checked" lay-skin="primary" name="like1" value="1">
											</div>
										</div>
										<div class="layui-inline">
											<label class="layui-form-label">端口号</label>
											<div class="layui-input-inline">
												<input type="text" id="pop3_port" autocomplete="off" class="layui-input">
											</div>
										</div>
										<div hidden="hidden">
										<input type="text" id="pop_email_num"  autocomplete="off" class="layui-input">
										</div>
									</div>
									<div class="layui-inline">
										<label class="layui-form-label">初始化收取邮件(首次有效)</label>
										<div class="layui-input-inline">
											<input type="radio" checked="checked" lay-skin="primary" name="pt" value="0" title="三个月">
											<input type="radio" lay-skin="primary" name="pt" value="1" title="六个月">
											<input type="radio" lay-skin="primary" name="pt" value="2" title="九个月">
											<input type="radio" lay-skin="primary" name="pt" value="3" title="全部">
										</div>
									</div>
									<div class="padding text-right">
										<button type="button" class="layui-btn layui-btn-primary" lay-submit="" lay-filter="form-element-zhanghao2_1" onclick="popLinkTest()">连接验证(成功保存)</button>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="setting" id="infrastructure">
				<form class="layui-form" action="" lay-filter="editor-form-infra">
					<div class="layui-form-item">
						<label class="layui-form-label">群发设置</label>
						<div class="layui-input-block">
							每封等待<input type="text" name="dedai1" autocomplete="off" id="momStart" class="layui-input" lay-verify="number">&nbsp;-&nbsp;<input type="text" id="momEnd" name="dedai2" lay-verify="number" autocomplete="off" class="layui-input">秒内的随机数
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">延迟发送</label>
						<div class="layui-input-block">
							<input type="checkbox" lay-skin="primary" name="qyyc" value="1" title="启用" lay-filter="qyyc">延迟<input type="text" name="yc" id="yc" disabled autocomplete="off" class="layui-input" lay-verify="number">分钟发送邮件
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">自动保存</label>
						<div class="layui-input-block">
							<input type="checkbox" lay-skin="primary" name="qybc" value="1" title="启用" lay-filter="qybc">每隔<input type="text" name="bc"  id="bc" disabled autocomplete="off" class="layui-input" lay-verify="number">分钟保存一次
						</div>
					</div>
					<div class="text-right">
						<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-infra" onclick="savedeploy()">保存</button>
					</div>
				</form>
			</div>

			<div class="setting" id="display">
				<form class="layui-form" action="" lay-filter="editor-form-display">
					<div class="layui-form-item">
						<label class="layui-form-label">显示模式</label>
						<div class="layui-input-block">
							<input type="radio" name="xsms" value="0" title="通栏模式">
							<input type="radio" name="xsms" value="1" title="分栏模式">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">默认时区设置</label>
						<div class="layui-input-block">
							<select name="selecttimezone" id="timeZone" lay-filter="">
								<option value="1">(UTC+08:00)北京，重庆，香港特别行政区，乌鲁木齐</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">默认字体</label>
						<div class="layui-input-inline">
							<select name="mrzt" id="font" lay-filter="mrzt">
								<option value="微软雅黑">微软雅黑</option>
								<option value="楷体">楷体</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">字体大小</label>
						<div class="layui-input-inline">
							<select name="ztdx" id="fontSize" lay-filter="ztdx">
								<option value="12px">12px</option>
								<option value="13px">13px</option>
								<option value="14px">14px</option>
								<option value="15px">15px</option>
								<option value="16px">16px</option>
								<option value="17px">17px</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">字体颜色</label>
						<div class="layui-input-inline" style="width: 120px;">
							<input type="text" value=""  placeholder="请选择颜色" class="layui-input" id="test-form-input" readonly>
						</div>
						<div class="layui-inline" style="left: -11px;">
							<div id="test-form"></div>
						</div>
					</div>
					<div class="weizi">
						<span>文字ABC</span>
					</div>
					<div class="text-right">
						<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-display" onclick="savedeploy()">保存</button>
					</div>
				</form>
			</div>

			<div class="setting" id="closesend">
				<form class="layui-form" action="" lay-filter="editor-form-closesend">
					<div class="ipt" id="cxr">
						<span>默认抄送人</span>
						<div class="xm-select">
							<input id="defaultCopy" value="" class="layui-hide"/>
						</div>
					</div>
					<div class="ipt" id="msr">
						<span>默认密送人</span>
						<div class="xm-select">
							<input id="defaultDark" value="" class="layui-hide"/>
						</div>
					</div>
					<div class="ipt" id="qzcxr">
						<span>强制抄送人</span>
						<div class="xm-select">
							<input id="forceCopy" value="" class="layui-hide"/>
						</div>
					</div>
					<div class="ipt" id="qzmsr">
						<span>强制密送人</span>
						<div class="xm-select">
							<input id="forceDark" value="" class="layui-hide"/>
						</div>
					</div>

					<div class="padding text-right">
						<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-display" onclick="savedeploy()">保存</button>
					</div>
				</form>
			</div>

			<div class="setting" id="blacklist">
				<div class="blacklist">
					<div class="blacklistlent">
						<ul id="blackEmail">
							<ol>邮件地址</ol>
						</ul>
						<div>
							<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="tjhmd('blacklistlent')">
								<i class="layui-icon">&#xe608;</i> 添加
							</button>
						</div>
					</div>
					<div class="blacklistr">
						<ul id="blackSubject">
							<ol>主题过滤字</ol>
						</ul>
						<div>
							<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="tjhmd('blacklistr')">
								<i class="layui-icon">&#xe608;</i> 添加
							</button>
						</div>
					</div>
					<div class="padding text-center" style="width: 100%">
						<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-display" onclick="savedeploy()">保存</button>
					</div>
				</div>
			</div>

			<div class="setting" id="signatureset">
				<div class="signaturesetdiv">
					<div class="layui-form layui-form-tjzh">
						<button type="button" class="layui-btn layui-btn-normal shijian" onclick="addTemRemove()" ><i class="layui-icon">&#xe624;</i>添加签名</button>
					</div>
					<hr>
					<ul class="yonghz" id="template">

					</ul>
				</div>
				<script type="text/javascript" src="statics/modules/ckeditor/ckeditor.js"></script>
				<div class="signaturesetdivr">
					<form class="layui-form" action="" lay-filter="editor-form-signatureset">
						<div class="layui-form-item">
							<label class="layui-form-label"><span style="color: red">*</span>签名名称</label>
							<div class="layui-input-block">
								<input type="text" value="" class="layui-input" name="qmmc" lay-verify="required" id="templateName">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"><span style="color: red">*</span>签名内容</label>
							<div class="layui-input-block">
								<textarea class="ckeditor" id="textarea" rows="100" cols="80" name="financial.bz"></textarea>
								<script type="text/javascript">
									CKEDITOR.replace('financial.bz', {
										height: 300,
										// Configure your file manager integration. This example uses CKFinder 3 for PHP.
										filebrowserBrowseUrl: '/erp/email/uploadCkEditor',
										filebrowserImageBrowseUrl: '/erp/email/uploadCkEditor',
										filebrowserUploadUrl: '/erp/email/uploadCkEditor',
										filebrowserImageUploadUrl: '/erp/email/uploadCkEditor',
										// filebrowserBrowseUrl: '/erp_ui_war_exploded/email/uploadCkEditor',
										// filebrowserImageBrowseUrl: '/erp_ui_war_exploded/email/uploadCkEditor',
										// filebrowserUploadUrl: '/erp_ui_war_exploded/email/uploadCkEditor',
										// filebrowserImageUploadUrl: '/erp_ui_war_exploded/email/uploadCkEditor',
									});
								</script>
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-signatureset" onclick="saveTemplate()">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>


			<div class="setting" id="receivingrules">
				<div class="receivingrulesdiv">
					<div class="layui-form layui-form-tjzh">
						<button type="button" class="layui-btn layui-btn-normal shijian"  onclick="newAddRule()"><i class="layui-icon">&#xe624;</i>新增收信规则</button>
					</div>
					<hr>
					<ul class="yonghz" id="EmailRules">

					</ul>
				</div>
				<div class="receivingrulesdivr">
					<form class="layui-form" action="" lay-filter="editor-form-receivingrules">
						<div class="layui-form-item">
							<label class="layui-form-label">规则触发条件</label>
							<div class="layui-input-block">
								<select name="gzcftj" lay-filter="">
									<option value="1">全部邮件</option>
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">执行操作</label>
							<div class="layui-input-block">
								<select name="zxcz" lay-filter="">
									<option value="1">直接归并</option>
								</select>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">收取至</label>
							<div class="layui-input-block">
								<div style="display: flex;width: 100%">
									<select name="sqzyx" lay-filter="" id="userBox">

									</select>
									&nbsp;&nbsp;
									<div>
										<input id="sqzwb" onblur="changeBox()" class="layui-input" name="sxgzmc" lay-verify="required"/>
									</div>
								</div>
								<span style="padding-top: 15px;display: block;">说明：当收取的是“全部邮件”时，邮件将被“直接归并”给“客户箱”-“按客户自动匹配”</span>
							</div>
						</div>
						<hr />
						<div class="layui-form-item">
							<label class="layui-form-label"><span style="color: red">*</span>归并主题</label>
							<div class="layui-input-block">
								<input type="text" value="" class="layui-input" name="sxgzmc" lay-verify="required" id="rule_name">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">归并发件地址</label>
							<div class="layui-input-block">
								<div class="xm-select">
									<input id="rule_context" value="" class="layui-hide"/>
								</div>
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-receivingrules" onclick="addRule()">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>

			<div class="setting" id="auditrules">
				<div class="auditrulesdiv">
					<div class="layui-form layui-form-tjzh">
						<button type="button" class="layui-btn layui-btn-normal shijian" data-type="tjzh"><i class="layui-icon">&#xe624;</i>新建审批规则</button>
					</div>
					<hr>
					<ul class="yonghz">
						<li>
							<span>1111111</span>
							<span class="caozuo"><i class="layui-icon" tooltip="删除">&#xe640;</i></span>
						</li>
						<li>
							<span>22222222</span>
							<span class="caozuo"><i class="layui-icon" tooltip="删除">&#xe640;</i></span>
						</li>
					</ul>
				</div>
				<div class="auditrulesdivr">
					<form class="layui-form" action="" lay-filter="editor-form-auditrules">
						<div class="layui-form-item">
							<label class="layui-form-label"><span style="color: red">*</span>审批规则名称</label>
							<div class="layui-input-block">
								<input type="text" value="" class="layui-input" name="spgzmc" lay-verify="required">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">审批条件</label>
							<div class="layui-input-block">
								<select name="sptj" lay-search lay-filter="sptj">
									<option value="全部审批">全部审批（强制）</option>
									<optgroup label="全部审批（可选）">
										<option value="邮件主题">邮件主题</option>
										<option value="邮件标签">邮件标签</option>
										<option value="发件地址">发件地址</option>
										<option value="收件地址">收件地址</option>
										<option value="附件名称">附件名称</option>
									</optgroup>
								</select>
							</div>
						</div>
						<div class="layui-form-item" style="margin-bottom: 0px">
							<div class="layui-input-block" style="display: none;margin-bottom: 15px;" id="spnrdiv">
								<select name="spnrtj" lay-filter="" style="margin-right: 5px">
									<option value="1">包含</option>
									<option value="2">等于</option>
								</select>
								<input type="text" value="" class="layui-input" name="spnr">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">审批人</label>
							<div class="layui-input-block">
								<div class="xm-select">
									<input id="spr" value="" class="layui-hide"/>
								</div>
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="form-element-auditrules">保存</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<div id="tjzhfrom" style="display: none;">
	<form class="layui-form" action="" style="padding:20px 20px 0 20px;">
		<div class="layui-form-item">
			<label class="layui-form-label">邮箱地址</label>
			<div class="layui-input-block">
				<input type="text" name="email" lay-verify="email|required" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">密码</label>
			<div class="layui-input-block">
				<input type="text" name="pass"  autocomplete="off" class="layui-input">
			</div>
		</div>
	</form>
</div>
<div id="tjhmddiv" style="display: none;">
	<form class="layui-form" action="" style="padding:20px 20px 0 20px;">
		<div class="layui-form-item" style="margin-bottom: 0px">
			<input type="text" name="tjhmd" autocomplete="off" class="layui-input" property="请输入...">
		</div>
	</form>
</div>

<%@ include file="../../tpl/foot.jsp"%>
<script src="statics/lay/modules/tagsInput.js"></script>
<script src="statics/js/BasicData/email/setting.js"></script>